package cn.xopencode.userservice.rpc;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.userservice.rpc.evaluate.EvaluateRpc;
import cn.xopencode.userservice.rpc.evaluate.dto.*;
import cn.xopencode.userservice.service.EvaluateService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Author xiaodawei
 * @since 2021/9/22
 */
@DubboService(version = "${dubbo.provider.EvaluateRpc.version}", validation = "false")
public class EvaluateRpcImpl implements EvaluateRpc {


    @Autowired
    private EvaluateService evaluateService;


    @Override
    public CommonResult<EvaluateDTO> getEvaluate(String evaluateId) {
        return CommonResult.success(evaluateService.getEavluate(evaluateId));
    }

    @Override
    public CommonResult<String> createEvaluate(CreateEvaluateDTO createEvaluateDTO) {
        return CommonResult.success(evaluateService.CreateEvaluate(createEvaluateDTO));
    }

    @Override
    public CommonResult<PageResult<EvaluateDTO>> findEvaluateList(EvaluatePageDTO evaluatePageDTO) {
        return CommonResult.success(evaluateService.findEvaluateList(evaluatePageDTO));
    }

    @Override
    public CommonResult<Integer> updateEvaluate(List<UpdateEvaluateDTO> updateEvaluateDTOList) {
        return CommonResult.success(evaluateService.updateEvaluate(updateEvaluateDTOList));
    }

    @Override
    public CommonResult<Integer> updateProperty(List<UpdatePropertyDTO> updatePropertyDTOList) {
        return CommonResult.success(evaluateService.updateProperty(updatePropertyDTOList));
    }
}
